package models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;


/**
 *  专辑
 * 
 * @author 李宇星 24/1/2015
 */
@Entity
@Table(name = "album")
public class Album extends BasicModel{
	
	//专辑作者ID
	@Column(name = "authorId")
	public String authorId;
	
	//专辑名
	@Column(name = "albumName")
	public String albumName;
	
	//专辑封面
	@Column(name = "photoId")
	public String photoId;

    //专辑说明
    @Column(name = "info")
    public String info;
	
	//title
	@Column(name = "title")
	public String title;
	
	//文章数
	@Column(name = "articleNum",columnDefinition = "int default 0")
	public int articleNum;
	
	public static String getAuthorIdById(String albumId)
	{
		Album album = Album.findById(albumId);
		if(album != null)
			return album.authorId;
		else
			return null;
	}

}
